home *** CD-ROM | disk | FTP | other *** search
/ The CICA Windows Explosion! / The CICA Windows Explosion! - Disc 2.iso / programr / wtj008.zip / OBJECTS.ZIP / TESTSCPP.CPP < prev    next >
C/C++ Source or Header  |  1992-05-17  |  869b  |  42 lines

  1. #include <stdio.h>
  2. #include <stdlib.h>
  3. #include <iostream.h>
  4. #include <windows.h>
  5. #include "tstrings.h"
  6.  
  7. void far_cout(LPSTR s)
  8. {
  9.   while (*s)
  10.     cout << *s++;
  11.   cout << '\n';
  12. }
  13.  
  14. #pragma argsused
  15. int PASCAL WinMain(HANDLE hInstance, HANDLE hPrevInstance,
  16.            LPSTR lpszCmdLine, int cmdShow)
  17. {
  18.   TString string1, string2;
  19.  
  20.   _InitEasyWin();
  21.  
  22.   //instantiate the TStrings
  23.   if (! TStringInit("This is string one", string1) ) {
  24.     cout << "Unable to instantiate string1\n";
  25.     return 1;
  26.   }
  27.   if (! TStringInit("This is string two", string2) ) {
  28.     cout << "Unable to instantiate string2\n";
  29.     return 2;
  30.   }
  31.  
  32.   //call the sGetString "method"
  33.   far_cout(string1.sGetString(string1));
  34.   far_cout(string2.sGetString(string2));
  35.  
  36.   //call the sDone "destructor"
  37.   string2.sDone(string2);
  38.   string1.sDone(string1);
  39.  
  40.   return 0;
  41. }
  42.